package com.example.qimo.data

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import kotlinx.coroutines.flow.Flow

@Dao
interface BillDao {
    @Insert
    suspend fun insertBill(bill: Bill)

    @Update
    suspend fun updateBill(bill: Bill)

    @Query("DELETE FROM bill_table WHERE id = :billId")
    suspend fun deleteBill(billId: Int)

    @Query("SELECT * FROM bill_table ORDER BY date DESC")
    fun getAllBills(): Flow<List<Bill>>
}
